package com.chinacoal.microservice;

import com.chinacoal.microservice.fallback.MaintenanceRecordsClientFallback;
import com.chinacoal.microservice.pojo.CcmsSmartleasingRepair;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 房源管理-维修记录
 * @date 2020-11-10 10：31
 */
@Api(tags = {"房源管理-维修记录"})
@FeignClient(name = "${spring.application.name}",fallback = MaintenanceRecordsClientFallback.class,configuration = FeignAutoConfiguration.class)
public interface MaintenanceRecordsClient {

    /**
     * @Description: 查询所有的维修记录（带分页）
     * @author zhuliang
     * @date 2020/11/10 13:55
     */
    @ApiOperation(value = "查询所有的维修记录（带分页）")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/maintenance/getList")
    public Result<List<CcmsSmartleasingRepair>> getMaintenanceRecords(@RequestBody QueryCriteria queryCriteria,
                                                                      @RequestHeader("token") String token);

    /**
     * @Description: 根据维修信息id查询对应的信息
     * @author zhuliang
     * @date 2020/11/10 14:18
     */
    @ApiOperation(value = "根据维修信息id查询对应的信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkRepairId", value = "维修信息id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/maintenance/getMaintenanceById/{pkRepairId}")
    public Result<CcmsSmartleasingRepair> getMaintenanceById(@PathVariable(value = "pkRepairId") String pkRepairId,
                                                             @RequestHeader("token") String token);

    /**
     * @Description: 添加维修信息
     * @author zhuliang
     * @date 2020/11/10 14:28
     */
    @ApiOperation(value = "添加维修信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "repair", value = "维修信息的实体信息", required = true, dataType = "CcmsSmartleasingRepair"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/maintenance/addMaintenanceRecords")
    public Result addMaintenanceRecords(@RequestBody CcmsSmartleasingRepair repair,
                                        @RequestHeader(value = "token") String token);

    /**
     * @Description: 修改维修信息
     * @author zhuliang
     * @date 2020/11/10 14:36
     */
    @ApiOperation(value = "修改维修信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "repair", value = "维修信息的实体信息", required = true, dataType = "CcmsSmartleasingRepair"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PutMapping("smartleasing/maintenance/updateMaintenanceRecords")
    public Result updateMaintenanceRecords(@RequestBody CcmsSmartleasingRepair repair,
                                           @RequestHeader(value = "token") String token);

    /**
     * @Description: 根据维修信息id批量删除对应的维修信息
     * @author zhuliang
     * @date 2020/11/10 14:41
     */
    @ApiOperation(value = "根据维修信息id批量删除对应的维修信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "deleteId", value = "要删除的id字符串", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @DeleteMapping("smartleasing/maintenance/delectMaintenanceRecords/{deleteId}")
    public Result delectMaintenanceRecords(@PathVariable(value = "deleteId",required = false) String deleteId,
                                           @RequestHeader(value = "token") String token);

    /**
     * @Description: 条件查询维修信息(带分页)
     * @author zhuliang
     * @date 2020/11/10 16:06
     */
    @ApiOperation(value = "条件查询维修信息(带分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件的实体", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/maintenance/query")
    public Result<List<CcmsSmartleasingRepair>> queryMaintenanceRecords(@RequestBody QueryCriteria queryCriteria,
                                                                        @RequestHeader(value = "token") String token);
}
